home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 6.5 KB | 199 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWFileSp.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #if !defined(FWFILESP_H) && !defined(__ODFRC__)
- #define FWFILESP_H
-
- #ifndef FWSOMPTR_H
- #include "FWSOMPtr.h"
- #endif
-
- #ifndef FWEXCDEF_H
- #include "FWExcDef.h"
- #endif
-
- #ifndef FWSTRS_H
- #include "FWStrs.h"
- #endif
-
- #ifndef FWSOMPTR_H
- #include "FWSOMPtr.h"
- #endif
-
- #include "SLFileSp.xh"
-
- #if defined(FW_BUILD_MAC) && !defined(__FILES__)
- #include <Files.h>
- #endif
-
- //========================================================================================
- // Forward class declarations
- //========================================================================================
- class FW_PDirectorySpecification;
-
-
- //========================================================================================
- // FW_PFileSpecification
- //
- // This class is used to identify a disk-based file.
- //========================================================================================
-
- class FW_PFileSpecification : public FW_TSOMPtr<FW_OFileSpecification>
- {
- public:
-
- FW_DECLARE_AUTO(FW_PFileSpecification)
-
- FW_PFileSpecification(Environment *ev,
- FW_ODirectorySpecification* directory,
- const FW_CString& fileName);
- // Create a file specification from a directory and a file name. The file name
- // should include any extensions that might be necessary.
-
- FW_PFileSpecification(Environment *ev, const FW_CString& pathName);
- // Create a file specification from a full or partial pathname. In the case of
- // a partial pathname, the specification will use the current default
- // directory to build a full pathname.
-
- FW_PFileSpecification(Environment *ev, FW_OFileSpecification* specification);
- FW_PFileSpecification(const FW_PFileSpecification& specificationPtr);
- // Copy Constructors
-
- ~FW_PFileSpecification();
- // Destructor
-
-
- //===========================================================
- // Operators
- //===========================================================
-
- FW_Boolean operator==(FW_OFileSpecification* theOtherFile) const;
- // Does this file represent the same file as theOtherFile.
-
- FW_Boolean operator!=(FW_OFileSpecification* theOtherFile) const;
- // Does this file not represent the same file as theOtherFile
-
-
- FW_PFileSpecification& operator=(const FW_PFileSpecification& theOtherFile);
- // Copy all of the file information from theOtherFile so that this file spec
- // represents the same file.
-
- FW_PFileSpecification& operator=(const FW_CString& fileName);
- // Change the name of this file to fileName. fileName may be a partial pathName.
- // This does not change any of the existing path information.
-
-
- #ifdef FW_BUILD_MAC
- public:
- FW_PFileSpecification(Environment *ev, const FSSpec& macSpec);
- // Create a file specification based on a Macintosh FSSpec.
-
- FW_PFileSpecification& operator=(const FSSpec& macSpec);
- // This specifier will now represent the file described by macSpec.
-
- private:
- void Clone(Environment *ev, const FSSpec& macSpec);
- #endif
-
- private:
- void Clone(Environment *ev, FW_OFileSpecification* specification);
- void Clone(Environment *ev, const FW_CString& fileName);
- };
-
-
- //----------------------------------------------------------------------------------------
- // FW_PFileSpecification::operator!=
- //----------------------------------------------------------------------------------------
-
- inline FW_Boolean FW_PFileSpecification::operator!=(FW_OFileSpecification* theOtherFile) const
- {
- return (!(FW_PFileSpecification::operator==(theOtherFile)));
- }
-
-
-
- //========================================================================================
- // FW_PDirectorySpecification
- //
- // This class is used to indentify a disk-based directory. A directory uses most of the
- // same information as a file specification, but is not a file.
- //========================================================================================
- class FW_PDirectorySpecification : public FW_TSOMPtr<FW_ODirectorySpecification>
- {
- public:
-
- FW_DECLARE_AUTO(FW_PDirectorySpecification)
-
- FW_PDirectorySpecification();
- // Specifies the current default directory
-
- FW_PDirectorySpecification(Environment *ev, FW_ODirectorySpecification* specification);
- FW_PDirectorySpecification(const FW_PDirectorySpecification& other);
- // Copy constructors
-
- FW_PDirectorySpecification(Environment *ev, const FW_CString& directoryName);
- // Specifies the path by string. directoryName can be either a full or
- // partial path name.
-
- ~FW_PDirectorySpecification();
- // Destructor
-
-
- //===========================================================
- // Operators
- //===========================================================
-
- FW_Boolean operator==(FW_ODirectorySpecification* theOtherDir) const;
- // Equality operator.
-
- FW_Boolean operator!=(FW_ODirectorySpecification* theOtherDir) const;
- // Inequality operator.
-
- FW_PDirectorySpecification& operator=(const FW_PDirectorySpecification& theOtherDir);
- // Assignment operator
-
- FW_PDirectorySpecification& operator=(const FW_CString& directoryName);
- // Change the directory name to directoryName. directoryName may be a partial
- // path name.
-
- FW_PDirectorySpecification& operator+=(const FW_CString& directoryName);
- // Add directoryName to the end of this path. This routine will add a path
- // separator so that the user does not need to. The remaining path information
- // may specify a subdirectory or parent directory, but must start from this
- // directory.
-
- #ifdef FW_BUILD_MAC
- public:
- FW_PDirectorySpecification(Environment *ev, const FSSpec& macSpec);
- // Create a directory spec from a Macintosh FSSpec.
-
- FW_PDirectorySpecification& operator=(const FSSpec& macSpec);
- // Assignment operator for a Macintosh spec.
- private:
- void Clone(Environment *ev, const FSSpec& macSpec);
- #endif
-
- private:
- void Clone(Environment *ev, FW_ODirectorySpecification* specification);
- void Clone(Environment *ev, const FW_CString& fileName);
- };
-
-
- //----------------------------------------------------------------------------------------
- // FW_PDirectorySpecification::operator!=
- //----------------------------------------------------------------------------------------
- inline FW_Boolean FW_PDirectorySpecification::operator!=(FW_ODirectorySpecification* theOtherDir) const
- {
- return (!(FW_PDirectorySpecification::operator==(theOtherDir)));
- }
-
- #endif
-
-
-